const express = require('express')
const {apiRouter} = require('./apiRouter')
const app = express()

app.use(express.json())//解析JSON格式数据
app.use(express.urlencoded({extended: false}))//解析URL-encoded格式数据
app.use('/api',apiRouter)
app.use((err,req,res,next)=>{
    console.log('内部错误！'+err.message)
    res.send(err.message)
})

//端口号
let port = 8083

//启动服务器
app.listen(port,()=>{
    console.log(`http server running at http://127.0.0.1:${port}`);
})